<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: lzy
  Date: 2018/7/28
  Time: 23:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>New Update</title>
</head>
<body>
<br>
<span style="color: red; ">
    <c:if test="${!empty requestScope.message}">
        ${requestScope.message}
    </c:if>
</span>
<br><br>

<c:set var="id" value="${customer!=null?customer.id:param.id}"/>
<c:set var="oldName" value="${customer!=null?customer.name:param.oldName}"/>
<c:set var="name" value="${customer!=null?customer.name:param.oldName}"/>
<c:set var="address" value="${customer!=null?customer.address:param.address}"/>
<c:set var="phone" value="${customer!=null?customer.phone:param.phone}"/>
<c:set var="contextPath" value="${pageContext.request.contextPath}"/>

<form action="${contextPath}/updateCustomer.do" method="post">
    <%--使用隐藏域来保存要修改的Customer对象的id--%>
    <input type="hidden" name="id" value=${id}>
    <input type="hidden" name="oldName" value=${oldName}>
    <table>
        <tr>
            <td>Customer Name</td>

            <td><input type="text" name="name"
                       value="${name}"/></td>
        </tr>
        <tr>
            <td>Address</td>
            <td><input type="text" name="address"
                       value="${address}"/></td>
        </tr>
        <tr>
            <td>Phone:</td>
            <td><input type="text" name="phone"
                       value="${phone}"/></td>
        </tr>
        <tr>
            <td colspan="2">
                <input type="submit" value="submit"/>
            </td>
        </tr>
    </table>
</form>
</body>
</html>
